package burubaka.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2012-05-04 21:41:09")
/** */
public final class MarkSheetMeta extends org.slim3.datastore.ModelMeta<burubaka.model.MarkSheet> {

    /** */
    public final org.slim3.datastore.StringUnindexedAttributeMeta<burubaka.model.MarkSheet> betClass = new org.slim3.datastore.StringUnindexedAttributeMeta<burubaka.model.MarkSheet>(this, "betClass", "betClass");

    /** */
    public final org.slim3.datastore.StringUnindexedAttributeMeta<burubaka.model.MarkSheet> betClassName = new org.slim3.datastore.StringUnindexedAttributeMeta<burubaka.model.MarkSheet>(this, "betClassName", "betClassName");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Integer> hitFlag = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Integer>(this, "hitFlag", "hitFlag", int.class);

    /** */
    public final org.slim3.datastore.StringUnindexedAttributeMeta<burubaka.model.MarkSheet> horseMark = new org.slim3.datastore.StringUnindexedAttributeMeta<burubaka.model.MarkSheet>(this, "horseMark", "horseMark");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.StringUnindexedAttributeMeta<burubaka.model.MarkSheet> mark = new org.slim3.datastore.StringUnindexedAttributeMeta<burubaka.model.MarkSheet>(this, "mark", "mark");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Long> wager = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Long>(this, "wager", "wager", long.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Long> withdrawal = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Long>(this, "withdrawal", "withdrawal", long.class);

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Double> withdrawalRate = new org.slim3.datastore.CoreAttributeMeta<burubaka.model.MarkSheet, java.lang.Double>(this, "withdrawalRate", "withdrawalRate", double.class);

    private static final MarkSheetMeta slim3_singleton = new MarkSheetMeta();

    /**
     * @return the singleton
     */
    public static MarkSheetMeta get() {
       return slim3_singleton;
    }

    /** */
    public MarkSheetMeta() {
        super("MarkSheet", burubaka.model.MarkSheet.class);
    }

    @Override
    public burubaka.model.MarkSheet entityToModel(com.google.appengine.api.datastore.Entity entity) {
        burubaka.model.MarkSheet model = new burubaka.model.MarkSheet();
        model.setBetClass((java.lang.String) entity.getProperty("betClass"));
        model.setBetClassName((java.lang.String) entity.getProperty("betClassName"));
        model.setHitFlag(longToPrimitiveInt((java.lang.Long) entity.getProperty("hitFlag")));
        model.setHorseMark((java.lang.String) entity.getProperty("horseMark"));
        model.setKey(entity.getKey());
        model.setMark((java.lang.String) entity.getProperty("mark"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        model.setWager(longToPrimitiveLong((java.lang.Long) entity.getProperty("wager")));
        model.setWithdrawal(longToPrimitiveLong((java.lang.Long) entity.getProperty("withdrawal")));
        model.setWithdrawalRate(doubleToPrimitiveDouble((java.lang.Double) entity.getProperty("withdrawalRate")));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        burubaka.model.MarkSheet m = (burubaka.model.MarkSheet) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setUnindexedProperty("betClass", m.getBetClass());
        entity.setUnindexedProperty("betClassName", m.getBetClassName());
        entity.setUnindexedProperty("hitFlag", m.getHitFlag());
        entity.setUnindexedProperty("horseMark", m.getHorseMark());
        entity.setUnindexedProperty("mark", m.getMark());
        entity.setProperty("version", m.getVersion());
        entity.setUnindexedProperty("wager", m.getWager());
        entity.setUnindexedProperty("withdrawal", m.getWithdrawal());
        entity.setUnindexedProperty("withdrawalRate", m.getWithdrawalRate());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        burubaka.model.MarkSheet m = (burubaka.model.MarkSheet) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        burubaka.model.MarkSheet m = (burubaka.model.MarkSheet) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        burubaka.model.MarkSheet m = (burubaka.model.MarkSheet) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void assignKeyToModelRefIfNecessary(com.google.appengine.api.datastore.AsyncDatastoreService ds, java.lang.Object model) {
    }

    @Override
    protected void incrementVersion(Object model) {
        burubaka.model.MarkSheet m = (burubaka.model.MarkSheet) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
    }

    @Override
    protected void postGet(Object model) {
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

    @Override
    protected boolean isCipherProperty(String propertyName) {
        return false;
    }

    @Override
    protected void modelToJson(org.slim3.datastore.json.JsonWriter writer, java.lang.Object model, int maxDepth, int currentDepth) {
        burubaka.model.MarkSheet m = (burubaka.model.MarkSheet) model;
        writer.beginObject();
        org.slim3.datastore.json.Default encoder0 = new org.slim3.datastore.json.Default();
        if(m.getBetClass() != null){
            writer.setNextPropertyName("betClass");
            encoder0.encode(writer, m.getBetClass());
        }
        if(m.getBetClassName() != null){
            writer.setNextPropertyName("betClassName");
            encoder0.encode(writer, m.getBetClassName());
        }
        writer.setNextPropertyName("hitFlag");
        encoder0.encode(writer, m.getHitFlag());
        if(m.getHorseMark() != null){
            writer.setNextPropertyName("horseMark");
            encoder0.encode(writer, m.getHorseMark());
        }
        if(m.getKey() != null){
            writer.setNextPropertyName("key");
            encoder0.encode(writer, m.getKey());
        }
        if(m.getMark() != null){
            writer.setNextPropertyName("mark");
            encoder0.encode(writer, m.getMark());
        }
        if(m.getVersion() != null){
            writer.setNextPropertyName("version");
            encoder0.encode(writer, m.getVersion());
        }
        writer.setNextPropertyName("wager");
        encoder0.encode(writer, m.getWager());
        writer.setNextPropertyName("withdrawal");
        encoder0.encode(writer, m.getWithdrawal());
        writer.setNextPropertyName("withdrawalRate");
        encoder0.encode(writer, m.getWithdrawalRate());
        writer.endObject();
    }

    @Override
    protected burubaka.model.MarkSheet jsonToModel(org.slim3.datastore.json.JsonRootReader rootReader, int maxDepth, int currentDepth) {
        burubaka.model.MarkSheet m = new burubaka.model.MarkSheet();
        org.slim3.datastore.json.JsonReader reader = null;
        org.slim3.datastore.json.Default decoder0 = new org.slim3.datastore.json.Default();
        reader = rootReader.newObjectReader("betClass");
        m.setBetClass(decoder0.decode(reader, m.getBetClass()));
        reader = rootReader.newObjectReader("betClassName");
        m.setBetClassName(decoder0.decode(reader, m.getBetClassName()));
        reader = rootReader.newObjectReader("hitFlag");
        m.setHitFlag(decoder0.decode(reader, m.getHitFlag()));
        reader = rootReader.newObjectReader("horseMark");
        m.setHorseMark(decoder0.decode(reader, m.getHorseMark()));
        reader = rootReader.newObjectReader("key");
        m.setKey(decoder0.decode(reader, m.getKey()));
        reader = rootReader.newObjectReader("mark");
        m.setMark(decoder0.decode(reader, m.getMark()));
        reader = rootReader.newObjectReader("version");
        m.setVersion(decoder0.decode(reader, m.getVersion()));
        reader = rootReader.newObjectReader("wager");
        m.setWager(decoder0.decode(reader, m.getWager()));
        reader = rootReader.newObjectReader("withdrawal");
        m.setWithdrawal(decoder0.decode(reader, m.getWithdrawal()));
        reader = rootReader.newObjectReader("withdrawalRate");
        m.setWithdrawalRate(decoder0.decode(reader, m.getWithdrawalRate()));
        return m;
    }
}